package cn.school.controller;


import cn.school.dto.FindPaperListDto;
import cn.school.dto.PaperAddDto;
import cn.school.dto.UpdateExamPaperDto;
import cn.school.service.ExamPaperService;
import cn.school.vo.FindPaperListVo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/paper")
public class PaperController {
    @Resource
    private ExamPaperService examPaperService;
    @RequestMapping("/addPaper")
    public String addPaper(@RequestBody PaperAddDto paperAddDto, HttpServletRequest request){
        String message = examPaperService.addPaper(paperAddDto,request);
        return message;
    }
    @RequestMapping("findPaperList")
    public List<FindPaperListVo> findPaperList(@RequestBody FindPaperListDto findPaperListDto){
        List<FindPaperListVo> list = examPaperService.findPaperList(findPaperListDto);
        return list;
    }
    @RequestMapping("updateExamPaper")
    public String updateExamPaper(@RequestBody UpdateExamPaperDto updateExamPaperDto, HttpServletRequest request){
        String message = examPaperService.updateExamPaper(updateExamPaperDto,request);
        return message;
    }
    @RequestMapping("deleteExamPaper")
    public String deleteExamPaper(String paperId, HttpServletRequest request){
        String message = examPaperService.deleteExamPaper(paperId,request);
        return message;
    }
}
